//package cn.joeg.web.core.interceptor;
//
//import com.ecfront.dew.common.Resp;
//import com.ecfront.dew.common.interceptor.DewInterceptRespBody;
//import com.ecfront.dew.core.Dew;
//import com.pubinfo.samantha.app.css.CSS;
//import com.pubinfo.samantha.app.css.dto.CallSession;
//import com.pubinfo.samantha.app.css.entity.WidgetOptTrace;
//import com.pubinfo.samantha.app.css.repository.WidgetOptTraceRepository;
//import com.pubinfo.samantha.app.css.widget.core.vo.WidgetDataReq;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.Map;
//
//@Component
//public class WidgetOptLogInterceptor extends WidgetDataFetchInterceptor {
//
//    @Autowired
//    private WidgetOptTraceRepository widgetOptTraceRepository;
//
//    @Override
//    public Resp<DewInterceptRespBody<WidgetDataReq>> before(WidgetDataReq obj, Map<String, Object> context) {
//        return Resp.success(DewInterceptRespBody.build(obj, context));
//    }
//
//    @Override
//    public Resp<DewInterceptRespBody<WidgetDataReq>> after(WidgetDataReq obj, Map<String, Object> context) {
//        String accountCode = Dew.context().optInfo().get().getAccountCode();
//        CallSession callSession = CSS.Call.getCallSession();
//        WidgetOptTrace optTrace = WidgetOptTrace.build(obj.getWidgetCode(), obj.getWidgetMethod(), callSession.getBusinessCode(), callSession.getSessionCode(), accountCode, obj.getWidgetDataResp().getBody().getData().toString());
//        widgetOptTraceRepository.save(optTrace);
//        return Resp.success(DewInterceptRespBody.build(obj, context));
//    }
//
//}
